﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebEntities;
using com.subb.WebInfo;
using com.subb.Tools.Pager;
using WebUI.ActionFilters;

namespace WebUI.Controllers
{
    public class AboutUsController : Controller
    {
        public AboutUsController()
            : base()
        {
            ViewBag.ActMenu = "aboutus";
        }

        public ActionResult Index()
        {
            int id = Extensions.CommonFn.GetContentID("AboutComId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }

        public ActionResult Honor()
        {
            int id = Extensions.CommonFn.GetContentID("HonorType1Id");
            WI_HonorDAL hdal = new WI_HonorDAL();
            List<WI_Honor> horList = hdal.GetAllHonors(id);
            return View(horList);
        }

        public ActionResult Honor2()
        {
            int id = Extensions.CommonFn.GetContentID("HonorType2Id");
            WI_HonorDAL hdal = new WI_HonorDAL();
            List<WI_Honor> horList = hdal.GetAllHonors(id);
            return View(horList);
        }

        public ActionResult Honor3()
        {
            int id = Extensions.CommonFn.GetContentID("HonorType3Id");
            WI_HonorDAL hdal = new WI_HonorDAL();
            List<WI_Honor> horList = hdal.GetAllHonors(id);
            return View(horList);
        }

        public ActionResult History()
        {
            int id = Extensions.CommonFn.GetContentID("ComHistoryId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }

        public ActionResult Culture()
        {
            int id = Extensions.CommonFn.GetContentID("CultureId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }

        public ActionResult Employee(int id = 1)
        {
            int pageCount = 15;
            int page = id < 1 ? 1 : id;
            int start = (page - 1) * pageCount;
            WI_NewsDAL ndal = new WI_NewsDAL();
            int cataId = Extensions.CommonFn.GetContentID("EmpNewsCataId");
            int ttlCount;
            List<WI_News> newsList = ndal.GetAllNews(cataId, start, pageCount, out ttlCount, string.Empty);
            PagedList<WI_News> pglist = newsList.ToPagedList(page, pageCount, ttlCount);
            return View(pglist);
        }

        [NewsViewCount]
        public ActionResult EmpActNews(int id)
        {
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, true);
            return View(news1);
        }

        public ActionResult LeftMenu(string muflag)
        {
            ViewBag.MenuFlag = muflag;
            return PartialView();
        }

        public ActionResult Organize()
        {
            int id = Extensions.CommonFn.GetContentID("OrganizeId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }

        public ActionResult Quality()
        {
            int id = Extensions.CommonFn.GetContentID("QualityId");
            WI_NewsDAL ndal = new WI_NewsDAL();
            WI_News news1 = ndal.GetNews(id, false);
            return View(news1);
        }
    }
}
